package fr.mairie.parc.control.installation;

import org.apache.click.control.FieldSet;
import org.apache.click.control.Form;
import org.apache.click.control.TextField;
import org.apache.click.extras.control.EmailField;
import org.apache.click.extras.control.IntegerField;

import fr.mairie.parc.domain.Installation;
import fr.mairie.parc.domain.Technicien;

public class InstallationFields {
	
	private FieldSet fieldset = new FieldSet("installationFieldset", "Technicien");
	private IntegerField idInstallation = new IntegerField("idInstallation", "ID",true);
	
	private TextField nom = new TextField("nom", "Nom",true);
	private TextField prenom = new TextField("prenom", "Prenom",true);
	private EmailField email = new EmailField("email", "Email",true);

	
	public InstallationFields(){
		//fieldset.add(idTechnicien);
		fieldset.add(nom);
		fieldset.add(prenom);
		fieldset.add(email);
		
	}
	
	public void addAll(Form form) {
		form.add(fieldset);		
	}

	public void setFieldsValues(Installation installation) {
		//idInstallation.setInteger(installation.getIdInstallation());
		/*nom.setValue(installation.getNom());
		prenom.setValue(installation.getPrenom());
		email.setValue(installation.getEmail());*/
	}
	
	public void getFieldsValues(Technicien in) {
		//in.setIdTechnicien(idTechnicien.getInteger());
		in.setNom(nom.getValue());
		in.setPrenom(prenom.getValue());
		in.setEmail(email.getValue());
		
	}
		
	public void setReadonly(boolean disabled) {
		fieldset.setReadonly(disabled);
	}

}
